<template>
<div>
	<el-form ref="form" :model="form" label-width="120px">
  <el-form-item label="账户">
    <el-input v-model="form.username" :disabled="true"></el-input>
  </el-form-item>
  <el-form-item label="姓名">
    <el-input v-model="form.realName" :disabled="true"></el-input>
  </el-form-item>
  <el-form-item label="推荐人">
    <el-input v-model="form.referUsername" :disabled="true"></el-input>
  </el-form-item>
  <el-form-item label="现金账户">
    <el-input v-model="form.balance" :disabled="true"></el-input>
  </el-form-item>
  <el-form-item label="董事红包">
    <el-input v-model="form.share"  :disabled="true"></el-input>
  </el-form-item>
  <el-form-item label="会员数量">
    <el-input v-model="form.memberNum" :disabled="true"></el-input>
  </el-form-item>
  <el-form-item label="市代">
    <el-input v-model="form.cityUsername" :disabled="true"></el-input>
  </el-form-item>
  <el-form-item label="区县代">
    <el-input v-model="form.regionUsername" :disabled="true"></el-input>
  </el-form-item>
</el-form>
</div>
</template>

<script>
import http from "assets/js/http.js";
import cities from "assets/data/address.json";

export default {
  data() {
    return {
      form: {
        username: null,
        realName: null,
        balance: null,
        levelTitle: null,
        position: null,
        regionNum: null,
        shopNum: null,
        memberNum: null
      }
    };
  },
  created() {
    this.getData();
  },
  methods: {
    getData() {
      const data = {
        params: {
          dataOfWho: "city"
        }
      };
      let url = "pudu/members/1";
      this.apiGet(url, data).then(res => {
        this.handelResponse(res, data => {
          console.log(res);
          for (let i in res.data) {
            if (i == "level") {
              if (res.data[i] == 0) {
                res.data[i] = "非董事";
              }
              if (res.data[i] == 1) {
                res.data[i] = "一级董事";
              }
              if (res.data[i] == 2) {
                res.data[i] = "二级董事";
              }
              if (res.data[i] == 3) {
                res.data[i] = "三级董事";
              }
              if (res.data[i] == 4) {
                res.data[i] = "四级董事";
              }
              if (res.data[i] == 5) {
                res.data[i] = "五级董事";
              }
              if (res.data[i] == 6) {
                res.data[i] = "六级董事";
              }
              if (res.data[i] == 7) {
                res.data[i] = "七级董事";
              }
            }
          }

          this.form = res.data;
          console.log(this.form);
          _g.closeGlobalLoading();
        });
      });
    }
  },
  mixins: [http]
};
</script>
